<!DOCTYPE html>
<head>
    <meta charset="UTF-8">
    <title>盱眙供电局路线配置</title>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link href="../../layui/css/layui.css" rel="stylesheet" type="text/css">
    <link href="../../css/style.css" rel="stylesheet" type="text/css">
    <link href="../../css/jquery-ui-1.10.4.custom.min.css" rel="stylesheet" type="text/css">
    <script src="../../layui/layui.js"></script>
    <script src="../../js/jquery-1.8.3.js"></script>
    <script src="../../js/util.js"></script>
    <script src="../../js/jquery-ui-1.10.4.custom.min.js"></script>
    <link href="../../css/jquery-ui-1.10.4.custom.min.css" rel="stylesheet" type="text/css">

    <script>
        layui.use(['table', 'form', 'jquery', 'element','layer'], function () {
            var table = layui.table;
            var form = layui.form;
            var $ = layui.$;
            var layer=layui.layer;
            var user;
            var options = {
                elem: "#table",
                id: "modelReload",
                url: '/xuYiContentCheck/findCheckList',
                method: 'post',
                request: {
                    pageName: 'page',
                    limitName: 'limit'
                },
                response: {
                    statusName: 'code',
                    statusCode: 0,
                    msgName: 'msg',
                    countName: 'count',
                    dataName: 'data'
                },
                loading: true,
                page: {
                    count: "count",
                    limit: 10,
                    limits: [10, 20,30,40,50],
                    layout: ['prev', 'page', 'next', 'skip', 'limit', 'count'],
                    prev: "上一页",
                    next: "下一页",
                    groups: 5
                },
                cols: [[ //表头
                    {field: 'checkTypeName', title: '审核类型',align:'center',width: '15%'},
                    {field: 'operatorTel', title: '操作人',align:'center',width: '15%'},
                    {field: 'createTime', title: '创建时间',align:'center',width: '15%'},
                    {field: 'checkOperatorTel', title: '审核人',align:'center',width: '15%', templet:function(d){
                            if(d.checkState=='0'){
                                return '<div style="color:grey;">/</div>'
                            }else{
                                return '<div>'+d.checkOperatorTel+'</div>'
                            }
                        }},
                    {field: 'modifyTime', title: '审核时间',align:'center',width: '15%', templet:function(d){
                            if(d.checkState=='0'){
                                return '<div style="color:grey;">/</div>'
                            }else{
                                return '<div>'+d.modifyTime+'</div>'
                            }
                        }},
                    {field: 'checkState', title: '审核状态',align:'center',width: '10%', templet:function(d){
                            if(d.checkState=='0'){
                                return '<div style="color:blue;">待审核</div>'
                            }else if(d.checkState=='1'){
                                return '<div style="color:green;">审核通过</div>'
                            }else if(d.checkState=='2'){
                                return '<div style="color:red;">审核不通过</div>'
                            }
                        }
                    },
                    {field: 'operation', title: '操作',align:'center', toolbar: '#barDemo'}
                ]],
                done: function (res) {
                    // console.log(JSON.stringify(res));
                }
            };

            table.render(options);
            table.on('tool(tableElement)', function (obj) {
                var data = obj.data;
                if (obj.event == 'check'&&(data.checkType =='4'||data.checkType =='5')) {
                    window.location.href = 'xuYiMgrContentCheck.html?checkId=' +data.checkId+"&mgrId="+data.mgrId+"&userDuty="+user.duty;
                }else if (obj.event == 'check'&&(data.checkType =='1'||data.checkType =='2'||data.checkType =='3')){
                    window.location.href = 'xuYiContentTempCheck.html?checkId=' +data.checkId+"&userDuty="+user.duty;
                }
            });
            //更新数据表
            $('#query').on('click', function () {

                var checkType=$("#checkType").val();
                console.info(checkType);

                var checkState = $("#checkState").val();
                console.info(checkState)
                var index = layer.load(1, {
                    shade: [0.1,'#fff'] //0.1透明度的白色背景
                });
                table.reload('modelReload', {
                    method: 'post',
                    page: {
                        curr: 1
                    },
                    where: {
                        checkType: checkType,
                        checkState:checkState
                    }
                });
                layer.close(index);

            });

            //身份识别
            $(document).ready(function () {
                qryCheckType("");
                findUserDuty();
            });

            //
            function  findUserDuty() {
                $.ajax({
                    type: 'post',
                    async: false,
                    url: '/util/findUser',
                    success: function (json) {
                        user=json;
                    }, error: function () {
                        layer.msg('系统异常，请联系管理员处理!');
                    }
                });
            }

            function qryCheckType(checkType) {
                var data;
                var url = '/xuYiContentCheck/findCheckType';
                var param = {
                    checkType : checkType
                };
                $.ajax({
                        type: 'post',
                        async: false,
                        url: url,
                        data : param,
                        success: function (json) {
                            data = json.data;
                            if (data.length != null) {
                                var options = '<option value="">全部</option>';
                                for (var i = 0; i < data.length; i++) {
                                    //console.info(data[i]);
                                    options += '<option value="' + data[i].value + '">' + data[i].dictName + '</option>';
                                }
                                $('#checkType').html(options);
                            } else {
                                $('#checkType').html('暂无审核类型信息');
                            }
                            form.render();

                        }, error: function () {
                            layer.msg('系统异常，请联系管理员处理!');
                        }
                    }
                );
                return data;
            }
        });

    </script>
    <script type="text/html" id="barDemo">
        <a href="javascript:void(0)" lay-event="check" id="check" style="color:blue;">审核详情</a>
    </script>
</head>
<body>
<div class="layui-content-body">
    <div class="scroll-box">
        <div class="breadcrumb-box">
            <span class="layui-breadcrumb" lay-separator="|">
                     <a href="javascript:returnIndex2()">首页&nbsp;</a>
                  <a href="#">短信内容审核</a>
            </span>
        </div>
        <div class="content-box">
            <div class="form-select-box">
                <div class="layui-form layui-form-pane">
                    <div class="layui-form-item">

                        <div id= "regionChoose">
                            <div class="layui-inline">
                                <label class="layui-form-label" style="width:120px;">审核类型:</label>
                                <div class="layui-input-block" style="width:180px;margin-left:120px;">
                                    <select name="checkType" lay-filter="checkType" id="checkType">

                                    </select>
                                </div>
                            </div>
                            <div class="layui-inline" >
                                <label class="layui-form-label" style="width:120px;">审核状态</label>
                                <div class="layui-input-block" style="width:180px;margin-left:120px;">
                                    <select name="checkState" lay-filter="checkState" id="checkState">
                                        <option value="">全部</option>
                                        <option value="0">待审核</option>
                                        <option value="1">审核通过</option>
                                        <option value="2">审核不通过</option>
                                    </select>
                                </div>
                            </div>
                            <div class="layui-inline" pane="">
                                <button class="layui-btn layui-btn-normal" id="query">查&nbsp;询</button>
                                <!-- <button class="layui-btn layui-btn-normal" id="test" >
                                    <i class="layui-icon">&#xe608;</i> 测试
                                </button> -->
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-table">
                    <table id="table" lay-filter="tableElement"></table>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>